"""tree URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from apps.users.views import UserDescView,UserAuth
from apps.operation.views import *
from django.conf.urls import url, include
import xadmin
from django.views.static import serve
from .settings import MEDIA_ROOT,STATIC_ROOT
urlpatterns = [
    # path('admin/', admin.site.urls),
    # 后台
    path('xadmin/', xadmin.site.urls),
    url(r'^api/v1/userdesc', UserDescView.as_view(), name='userdesc'),
    # 登录
    url(r'^api/v1/login', UserAuth.as_view(), name='login'),
    # 增删改查话题
    url(r'^api/v1/topic', TopicView.as_view(), name='topic'),
    # 图片增删
    url(r'^api/v1/imgtopic', TopicImgView.as_view(), name='posttopicimg'),
    # 所有话题
    url(r'^api/v1/alltopic', TopicAllView.as_view(), name='alltopic'),
    # 点赞
    url(r'^api/v1/like', LikeView.as_view(), name='like'),
    # 评论
    url(r'^api/v1/comment', CommentView.as_view(), name='comment'),
    # 图片
    url('^media/(?P<path>.*)$', serve, {"document_root":MEDIA_ROOT}),
    # 标签
    url(r'^api/v1/tag', TagView.as_view(), name='tag'),
    # 消息
    url(r'^api/v1/message', MessageView.as_view(), name='message'),
# 添加静态文件的访问处理函数不 在服务器就注释
#     url(r'^static/(?P<path>.*)/$', serve, {'document_root': STATIC_ROOT}),
]
